<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/employer/tmpl/job_appliedapplications.php
 ^
 * Description: template view for my job applied application
 ^
 * History:		NONE
 ^
 */

  defined('_JEXEC') or die('Restricted access');

 global $mainframe;
 $document =& JFactory::getDocument();
 $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
 $document->addStyleSheet('components/com_wrecruit/css/wrecruitresumerating.css');
?>
<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>
</table>
<?php }else{ ?>

   
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >
		<?php echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr><td height="0"></td></tr>
	<tr><td class="curloc">
		<?php echo JText::_('JS_CUR_LOC'); ?> :<a href='index.php?option=com_wrecruit&view=employer&layout=myfolders' class="curloclnk" > <?php echo JText::_('JS_MY_FOLDERS'); ?> </a> > <?php echo JText::_('JS_MY_FOLDERS_RESUMES'); ?>
	</td></tr>
	<?php } ?>
	<tr><td>
		<?php
			$cutomlink = 'index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=myfolders&Itemid='.$this->Itemid;
			$cutomlinktext = JText::_('JS_MY_FOLDER');
			$count = 0;
			if (sizeof($this->employerlinks) != 0){
				echo '<div id="toplinks"><ul>';

				foreach($this->employerlinks as $lnk)	{
					if ($count == 1) { ?>
						<span>
							<a href="<?php echo $cutomlink; ?>"> <?php echo $cutomlinktext; ?></a>
						</span>
					<?php }	?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php $count++;
				}
				echo '<ul></div>';

			}
		?>
	</td></tr>
	<tr><td height="3"></td></tr>
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_MY_FOLDERS_RESUMES'); ?>
	</td></tr>
	<tr><td height="3"></td></tr>
</table>
<?php
if ($this->resume){
if ($this->userrole->rolefor == 1) { // employer
?>

<table cellpadding="1" cellspacing="0" border="0" width="100%">
        </tr>
			<?php
		$tdclass = array($this->theme['odd'], $this->theme['even']);
		$isodd =1;
                $count = 0;
                    foreach($this->resume as $app)	{
                            $count++;
                            $isodd = 1 - $isodd;
                            $resumelink = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=view_resume&vm=5&rd='.$app->appid.'&fd='.$this->fd;?>
                            <tr class="<?php echo $tdclass[$isodd]; ?>">
                            <td ><?php  echo '<strong>'; ?><?php echo $app->first_name.' '.$app->last_name; ?><?php  echo '</strong>'; ?></td>
                            <td ><?php if($app->gender==1) echo JText::_('JS_MALE');
                                                    elseif($app->gender==2) echo JText::_('JS_FEMALE');
                                                    else  echo JText::_('JS_DOES_NOT_MATTER')?></td>
                            <td ><?php echo $this->config['currency'] . $app->rangestart . ' - ' . $this->config['currency'] . $app->rangeend ?></td>
                            <td ><?php echo date($this->config['date_format'],strtotime($app->apply_date)); ?></td>
                            <td align="center"><?php echo $app->total_experience;  ?></td>
                            <td>
                                    <a class="pageLink" href="<?php echo $resumelink?>"><?php echo JText::_('JS_RESUME');?></a>
                            </td>
                            <td></td>
                        </tr>
                        <tr class="<?php echo $tdclass[$isodd]; ?>">
                            <td >
                                <strong><?php echo JText::_('JS_COMMENTS'); ?></strong>
                            </td>
                            <td colspan="4">
                                <div>
                                    <?php echo  $app->comments; ?>
                                </div>
                            </td>
                            <td colspan="3">
                                <div>
                                <?php
                                    $id = $app->id;
                                    $percent = 0;
                                    $stars = '';
                                    $percent = $app->rating * 20;
                                    $stars = '-small';
                                    $html="
                                        <div class=\"wrecruit-container".$stars."\"".( " style=\"margin-top:5px;\"" ).">
                                        <ul class=\"wrecruit-stars".$stars."\">
                                        <li id=\"rating_".$id."\" class=\"current-rating\" style=\"width:".(int)$percent."%;\"></li>
                                        <li><a href=\"javascript:void(null)\" onclick=\"javascript:setrating('rating_".$id."',1,".(int)$app->ratingid.",".$app->id.",".$app->appid.");\" title=\"".JTEXT::_('Very Poor')."\" class=\"one-star\">1</a></li>
                                        <li><a href=\"javascript:void(null)\" onclick=\"javascript:setrating('rating_".$id."',2,".(int)$app->ratingid.",".$app->id.",".$app->appid.");\" title=\"".JTEXT::_('Poor')."\" class=\"two-stars\">2</a></li>
                                        <li><a href=\"javascript:void(null)\" onclick=\"javascript:setrating('rating_".$id."',3,".(int)$app->ratingid.",".$app->id.",".$app->appid.");\" title=\"".JTEXT::_('Regular')."\" class=\"three-stars\">3</a></li>
                                        <li><a href=\"javascript:void(null)\" onclick=\"javascript:setrating('rating_".$id."',4,".(int)$app->ratingid.",".$app->id.",".$app->appid.");\" title=\"".JTEXT::_('Good')."\" class=\"four-stars\">4</a></li>
                                        <li><a href=\"javascript:void(null)\" onclick=\"javascript:setrating('rating_".$id."',5,".(int)$app->ratingid.",".$app->id.",".$app->appid.");\" title=\"".JTEXT::_('Very Good')."\" class=\"five-stars\">5</a></li>
                                        </ul>
                                        </div>
                                    ";
                                    $html .="</small></span>";
                                    echo $html;
                                ?>
                                </div>
                            </td>


                        </tr>
                        <tr class="<?php echo $tdclass[$isodd]; ?>">
                            <td>
                                <strong><?php echo JText::_('JS_LOCATION'); ?></strong>
                            </td>
                            <td colspan="7" align="left">
                                <?php
                                    if ($app->cityname) { echo $app->cityname; $comma = 1; }
                                    elseif ($app->address_city) { echo $app->address_city; $comma = 1; }
                                    if ($app->countyname) { if($comma) echo', '; echo $app->countyname; $comma = 1; }
                                    elseif ($app->address_county) { if($comma) echo', '; echo $app->address_county; $comma = 1; }
                                    if ($app->statename) { if($comma) echo', '; echo $app->statename; $comma = 1; }
                                    elseif ($app->address_state) { if($comma) echo', '; echo $app->address_state; $comma = 1; }
                                    if ($app->countryname) { if($comma) echo', '; echo $app->countryname; $comma = 1; }
                                 ?>
                            </td>
                        </tr>
                    <tr><td height="15"></td></tr>

                    <?php
                    }
		?>
		</table>
			<input type="hidden" name="layout" value="folder_resumes" />
			<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
			<input type="hidden" name="folderid" id="folderid" value="<?php echo $this->fd; ?>" />
			<input type="hidden" name="resumeid" id="resumeid" value="<?php echo $app->appid; ?>" />
			<input type="hidden" name="id" id="id" value="" />
<script>
function setrating(src,newrating,ratingid,jobid,resumeid){
	var xhr;
	try {  xhr = new ActiveXObject('Msxml2.XMLHTTP');   }
	catch (e)
	{
		try {   xhr = new ActiveXObject('Microsoft.XMLHTTP');    }
		catch (e2)
		{
		  try {  xhr = new XMLHttpRequest();     }
		  catch (e3) {  xhr = false;   }
		}
	 }

	xhr.onreadystatechange = function(){
      if(xhr.readyState == 4 && xhr.status == 200){
               if(xhr.responseText == 1)
                document.getElementById(src).style.width=parseInt(newrating*20)+'%';

      }
    }

	xhr.open("GET","index.php?option=com_wrecruit&task=saveresumerating&ratingid="+ratingid+"&jobid="+jobid+"&resumeid="+resumeid+"&newrating="+newrating,true);
	xhr.send(null);


}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=folder_resumes&fd='.$this->fd.'&Itemid='.$this->Itemid); ?>" method="post">
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
    <tr>
        <td></td>
        <td >
            <?php
            echo $this->pagination->getPagesLinks();
            ?>
        </td>
    </tr>
    <tr>
        <td align="left">
            <?php echo JText::_('JS_DISPLAY_#'); ?>
            <?php
            echo $this->pagination->getLimitBox();
            ?>
        </td>
        <td align="right">
            <?php
            echo $this->pagination->getResultsCounter();
            ?>
        </td>
    </tr>
</table>
</form>
<?php
}else{ // no result found in this category
	echo JText::_('JS_RESULT_NOT_FOUND');
}

} else{ // not allowed job posting
echo JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW');
}
}//ol
?>
<div width="100%">
<?php
if($this->config['fr_cr_txsh']) {
	echo
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}
?>
</div>























